package cn.sc.allinpay.allfavour.business.common.popwindow;

import android.app.Activity;
import android.view.View;

import cn.sc.allinpay.allfavour.R;

/**
 * description：收银宝支付调用
 * author：pany
 * on 2018/1/16 16:34
 */
public class AllinPayPopWindow extends PopWindow implements View.OnClickListener {

    private OnPayListener onPayListener;

    public AllinPayPopWindow(Activity activity) {
        super(activity);
    }

    @Override
    protected int layoutId() {
        return R.layout.pop_allin_pay;
    }

    @Override
    protected void layoutView(View view) {
        find(R.id.tvCard).setOnClickListener(this);
        find(R.id.tvScan).setOnClickListener(this);
    }

    @Override
    protected int getHeight() {
        int height = getScreenHeight();
        return (int) (height * 0.2f);
    }

    @Override
    protected int getAnimationStyle() {
        return R.style.pop_window_anim;
    }

    @Override
    public void onClick(View view) {
        dismiss();
        switch (view.getId()) {
            case R.id.tvCard:
                onPayListener.onCardPay();
                break;
            case R.id.tvScan:
                onPayListener.onScanPay();
                break;
        }
    }

    public void setOnPayListener(OnPayListener onPayListener) {
        this.onPayListener = onPayListener;
    }

    public interface OnPayListener {
        void onCardPay();
        void onScanPay();
    }
}
